package com.example.jpa1;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;
//Spring MVC
//Model  模型
//View  视图
//Controller  控制

//Controller  控制器
//Control  控制
//Ctrl+C

public interface PoemWjmRepository extends PagingAndSortingRepository<PoemWjm,Long> {
    @Query(value = "select * from " +
            "poem_wjm " +
            "where poet_name=:p1 "
            , nativeQuery = true)
    List<PoemWjm> findByPoetName(String p1);

    @Query(value = "select * from " +
            "poem_wjm " +
            "where poem_chaodai=:p2 "
            , nativeQuery = true)
    List<PoemWjm> findByPoemChaodai(String p2);

    @Query(value = "select * from " +
            "poem_wjm " +
            "where poem_type=:p3 "
            , nativeQuery = true)
    List<PoemWjm> findByPoemType(String p3);

    @Query(value = "select * from poem_wjm " +
            "where poem_content like %:p%"
            , nativeQuery = true)
    List<PoemWjm> findByPoemContent(String p);

    @Query(value = "select * from " +
            "poem_wjm " +
            "where poem_name=:p4 "
            , nativeQuery = true)
    List<PoemWjm> findByPoemName(String p4);

}